<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailoss_mse.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ailoss__mse_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ailoss_mse.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ailoss__mse_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"><a class="line" href="ailoss__mse_8h.html#a4ecc6690c6bbd44ac711d874609d9b30">    1</a></span>&#160; </div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">#ifndef MSE_LOSS</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">#define MSE_LOSS</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aifes__core_8h.html">core/aifes_core.h</a>&quot;</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structailoss__mse.html">ailoss_mse</a>   <a class="code" href="structailoss__mse.html">ailoss_mse_t</a>; </div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="structailoss__mse.html">   50</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structailoss__mse.html">ailoss_mse</a> {</div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="structailoss__mse.html#af58495f6e7c4a5ca0662f23c2426927c">   51</a></span>&#160;    <a class="code" href="structailoss.html">ailoss_t</a> <a class="code" href="structailoss__mse.html#af58495f6e7c4a5ca0662f23c2426927c">base</a>; </div>
<div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="structailoss__mse.html#abf7a461af7296a09d5246ca13591b988">   52</a></span>&#160;    <span class="keyword">const</span> <a class="code" href="structaimath__dtype.html">aimath_dtype_t</a> *<a class="code" href="structailoss__mse.html#abf7a461af7296a09d5246ca13591b988">dtype</a>; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="structailoss__mse.html#a2a66dbdd12def87d03f2f773a5e379f0">   64</a></span>&#160;    void (*<a class="code" href="structailoss__mse.html#a2a66dbdd12def87d03f2f773a5e379f0">mse_gradients</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *predicted, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *target, <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="structailoss__mse.html#ad2a12952092157bd8f5e8bc4bee6aaae">   71</a></span>&#160;    void (*<a class="code" href="structailoss__mse.html#ad2a12952092157bd8f5e8bc4bee6aaae">mse_loss</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *predicted, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *target, <span class="keywordtype">void</span> *result);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;};</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160; </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structaicore__losstype.html">aicore_losstype_t</a> *<a class="code" href="ailoss__mse_8h.html#aa58e735242526fbaacbc1fa202ce901c">ailoss_mse_type</a>;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="ailoss__mse_8h.html#a7de83890af53274746bd3011e87567f7">   94</a></span>&#160;<a class="code" href="structailoss.html">ailoss_t</a> *<a class="code" href="ailoss__mse_8h.html#a7de83890af53274746bd3011e87567f7">ailoss_mse</a>(<a class="code" href="structailoss__mse.html">ailoss_mse_t</a> *loss, <a class="code" href="structailayer.html">ailayer_t</a> *input_layer);</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="ailoss__mse_8h.html#a6fdd9097e7e0b855788017e04c79bd08">  118</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailoss__mse_8h.html#a6fdd9097e7e0b855788017e04c79bd08">ailoss_mse_calc_delta</a>(<a class="code" href="structailoss.html">ailoss_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *target_data);</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="ailoss__mse_8h.html#ad8df1d03909afe4f5dd9fec68e217481">  144</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailoss__mse_8h.html#ad8df1d03909afe4f5dd9fec68e217481">ailoss_mse_calc_loss</a>(<a class="code" href="structailoss.html">ailoss_t</a> *<span class="keyword">self</span>, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *target_data, <span class="keywordtype">void</span> *result);</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160; </div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="preprocessor">#ifdef AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="line" href="ailoss__mse_8h.html#aba542f3b1fa45eacfe10ee52b4d28d54">  151</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailoss__mse_8h.html#aba542f3b1fa45eacfe10ee52b4d28d54">ailoss_mse_print_specs</a>(<span class="keyword">const</span> <a class="code" href="structailoss.html">ailoss_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160; </div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// MSE_LOSS</span></div>
<div class="ttc" id="aaifes__core_8h_html"><div class="ttname"><a href="aifes__core_8h.html">aifes_core.h</a></div><div class="ttdoc">AIfES 2 core interface.</div></div>
<div class="ttc" id="aailoss__mse_8h_html_a6fdd9097e7e0b855788017e04c79bd08"><div class="ttname"><a href="ailoss__mse_8h.html#a6fdd9097e7e0b855788017e04c79bd08">ailoss_mse_calc_delta</a></div><div class="ttdeci">void ailoss_mse_calc_delta(ailoss_t *self, const aitensor_t *target_data)</div><div class="ttdoc">Calculate the derivative of the given MSE loss for error backpropagation.</div></div>
<div class="ttc" id="aailoss__mse_8h_html_a7de83890af53274746bd3011e87567f7"><div class="ttname"><a href="ailoss__mse_8h.html#a7de83890af53274746bd3011e87567f7">ailoss_mse</a></div><div class="ttdeci">ailoss_t * ailoss_mse(ailoss_mse_t *loss, ailayer_t *input_layer)</div><div class="ttdoc">Initialize and connect the given MSE loss.</div></div>
<div class="ttc" id="aailoss__mse_8h_html_aa58e735242526fbaacbc1fa202ce901c"><div class="ttname"><a href="ailoss__mse_8h.html#aa58e735242526fbaacbc1fa202ce901c">ailoss_mse_type</a></div><div class="ttdeci">const aicore_losstype_t * ailoss_mse_type</div><div class="ttdoc">Mean Squared Error loss type.</div></div>
<div class="ttc" id="aailoss__mse_8h_html_aba542f3b1fa45eacfe10ee52b4d28d54"><div class="ttname"><a href="ailoss__mse_8h.html#aba542f3b1fa45eacfe10ee52b4d28d54">ailoss_mse_print_specs</a></div><div class="ttdeci">void ailoss_mse_print_specs(const ailoss_t *self)</div><div class="ttdoc">Print the loss specification.</div></div>
<div class="ttc" id="aailoss__mse_8h_html_ad8df1d03909afe4f5dd9fec68e217481"><div class="ttname"><a href="ailoss__mse_8h.html#ad8df1d03909afe4f5dd9fec68e217481">ailoss_mse_calc_loss</a></div><div class="ttdeci">void ailoss_mse_calc_loss(ailoss_t *self, const aitensor_t *target_data, void *result)</div><div class="ttdoc">Calculate the MSE loss on the given target data.</div></div>
<div class="ttc" id="astructaicore__losstype_html"><div class="ttname"><a href="structaicore__losstype.html">aicore_losstype</a></div><div class="ttdoc">Type indicator of the loss to check for the loss type.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:121</div></div>
<div class="ttc" id="astructailayer_html"><div class="ttname"><a href="structailayer.html">ailayer</a></div><div class="ttdoc">AIfES layer interface.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:252</div></div>
<div class="ttc" id="astructailoss__mse_html"><div class="ttname"><a href="structailoss__mse.html">ailoss_mse</a></div><div class="ttdoc">General Mean Squared Error (MSE) loss  struct.</div><div class="ttdef"><b>Definition:</b> ailoss_mse.h:50</div></div>
<div class="ttc" id="astructailoss__mse_html_a2a66dbdd12def87d03f2f773a5e379f0"><div class="ttname"><a href="structailoss__mse.html#a2a66dbdd12def87d03f2f773a5e379f0">ailoss_mse::mse_gradients</a></div><div class="ttdeci">void(* mse_gradients)(const aitensor_t *predicted, const aitensor_t *target, aitensor_t *result)</div><div class="ttdoc">Required math function: Gradient calculation of MSE loss function.</div><div class="ttdef"><b>Definition:</b> ailoss_mse.h:64</div></div>
<div class="ttc" id="astructailoss__mse_html_abf7a461af7296a09d5246ca13591b988"><div class="ttname"><a href="structailoss__mse.html#abf7a461af7296a09d5246ca13591b988">ailoss_mse::dtype</a></div><div class="ttdeci">const aimath_dtype_t * dtype</div><div class="ttdoc">Main data type of the loss.</div><div class="ttdef"><b>Definition:</b> ailoss_mse.h:52</div></div>
<div class="ttc" id="astructailoss__mse_html_ad2a12952092157bd8f5e8bc4bee6aaae"><div class="ttname"><a href="structailoss__mse.html#ad2a12952092157bd8f5e8bc4bee6aaae">ailoss_mse::mse_loss</a></div><div class="ttdeci">void(* mse_loss)(const aitensor_t *predicted, const aitensor_t *target, void *result)</div><div class="ttdoc">Required math function: Calculation of the MSE loss function.</div><div class="ttdef"><b>Definition:</b> ailoss_mse.h:71</div></div>
<div class="ttc" id="astructailoss__mse_html_af58495f6e7c4a5ca0662f23c2426927c"><div class="ttname"><a href="structailoss__mse.html#af58495f6e7c4a5ca0662f23c2426927c">ailoss_mse::base</a></div><div class="ttdeci">ailoss_t base</div><div class="ttdoc">Inherited field members from general ailoss struct.</div><div class="ttdef"><b>Definition:</b> ailoss_mse.h:51</div></div>
<div class="ttc" id="astructailoss_html"><div class="ttname"><a href="structailoss.html">ailoss</a></div><div class="ttdoc">AIfES loss interface.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:385</div></div>
<div class="ttc" id="astructaimath__dtype_html"><div class="ttname"><a href="structaimath__dtype.html">aimath_dtype</a></div><div class="ttdoc">Indicator for the used datatype.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:44</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1e5d3661ed79af157d57e64a38265d09.html">basic</a></li><li class="navelem"><a class="el" href="dir_90008ee2b0f86999412b56217da88d54.html">base</a></li><li class="navelem"><a class="el" href="dir_37a1ab58f3df7c16fa288867d2fe5335.html">ailoss</a></li><li class="navelem"><a class="el" href="ailoss__mse_8h.html">ailoss_mse.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
